package models

import (
	"errors"
)

// CheckLogin 检查用户名和密码
func CheckLogin(username string, password string) error {


	var DbPass, err = getPasswordFromDbQuery.Query(username)

	if !DbPass.Next() {
		return errors.New("username or password error")
	}
	var ps = ""
	err = DbPass.Scan(&ps)
	CheekErr(err)
	_=DbPass.Close()
	if ps == password {
		return nil
	} else {
		return errors.New("username or password error")
	}

}
